window.onload = function () {

    initTable();
}

function initTable() {

    var table2 = document.getElementById('list');

    for(var key in  employees){
        var employee=employees[key]
        var tRow = document.createElement('tr');
        for (var key2 in employee){
            if(key2!="id"){
                var tData = document.createElement('td');
                tData.innerText = employee[key2];
                tRow.appendChild(tData);
            }
        }
        var tdForCommand = document.createElement('td')
        var btnRemove= document.createElement('button');
        btnRemove.innerText = "删除";
        btnRemove.onclick=function(){
          //  alert(this.innerText);
            var currentRow = this.parentElement.parentElement;
            console.log(currentRow) ;
            table2.removeChild(currentRow);
        }
        tdForCommand.appendChild(btnRemove);
        tRow.appendChild(tdForCommand);
        table2.appendChild(tRow);
    }

}